﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CityDashboard.Models;

namespace CityDashboard.Services
{
    public class DataService
    {
        private readonly HttpService _httpService;
        public DataService()
        {
            _httpService = new HttpService();
        }
        public Task<ThongKe> LaySoLieuThongKe()
        {
            return _httpService.GetAsync<ThongKe>(string.Format(ApiConfig.API_URL + "/thongke"));
        }

        public Task<List<HoSoDangGiaiQuyetChiTiet>> ChiTietHoSo(int type, string xuly)
        {
            return
                _httpService.GetAsync<List<HoSoDangGiaiQuyetChiTiet>>(
                    string.Format(ApiConfig.API_URL + "/hoso?type={0}&xuly={1}", type, xuly));
        }

        public Task<List<TinhTrangXL>> TrangThaiHoSo(string soBN)
        {
            return
                _httpService.GetAsync<List<TinhTrangXL>>(
                    string.Format(ApiConfig.API_URL + "/xulyhs?mahoso={0}", soBN));
        }

        public Task<List<HoSoChiTiet>> HoSo(char trinhUB, char daXuLy, char dungHan)
        {
            return _httpService.GetAsync<List<HoSoChiTiet>>(
                    string.Format(ApiConfig.API_URL + "/hoso?trinhUB={0}&daXuLy={1}&dungHan={2}", trinhUB, daXuLy,
                        dungHan));
        }

        public Task<List<HoSoChiTiet>> TimHoSo(string soBN)
        {
            return _httpService.GetAsync<List<HoSoChiTiet>>(string.Format(ApiConfig.API_URL + "/hoso?sobn={0}", soBN));
        }
    }
}
